package team.seekers.hula.common.entity.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.Arrays;

@Getter
public enum WindSpaceTypeEnum implements IEnum<Integer> {

    ISLAND_MEMORY(0, "ISLAND_MEMORY", "记忆浪屿"),
    ISLAND_POST(1,"ISLAND_POST","帖子浪屿"),
    ISLAND_ARTICLE(2,"ISLAND_ARTICLE","创作浪屿"),
    COURSE(3, "COURSE", "知桨"),
    QUESTION(4, "QUESTION", "问题");

    private int type;

    private String name;

    private String cnName;

    WindSpaceTypeEnum(int type, String name, String cnName) {
        this.type = type;
        this.name = name;
        this.cnName = cnName;
    }

    @Override
    public Integer getValue() {
        return this.type;
    }

    public static WindSpaceTypeEnum getByType(int type) {
        return Arrays.stream(values()).filter(e -> e.getType() == type).findFirst().orElse(null);
    }

    public static WindSpaceTypeEnum getByName(String name) {
        return Arrays.stream(values()).filter(e -> e.getName().equals(name)).findFirst().orElse(null);
    }
}
